package services;

import Dao.PermissionDao;
import entity.PermissionBean;

import java.util.List;

public class PermissionServiceAll {
    private PermissionDao permissionDao = new PermissionDao();

    public List<PermissionBean> all(){ return permissionDao.all(); }

    public PermissionBean one(int id){ return permissionDao.one(id); }

    public List<PermissionBean> SearchByname(String searchbyname){return permissionDao.searchbyname(searchbyname);}

    public List<PermissionBean> SearchBylevelId(int levelKeyIndex){return permissionDao.searchbylevelid(levelKeyIndex);}

    public int add(PermissionBean permission){
        if(permission == null){
            throw new RuntimeException("用户对象为空");
        }
        return permissionDao.add(permission);
    }

    public int dele(int id){return permissionDao.del(id);}
}
